﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace firstrpg
{

    
    /// <summary>
    /// Each instance of this class is a 'inv_back.png' block on the screen
    /// This class also statically handles toggling equipment menu and functionality
    /// </summary>
    class inventory_screen
    {
        item contain;
        static bool show_equipment         = false;     //shows the equipment hud (like SS13)
        static bool show_equipment_window  = false;     //same as equipment but shows every slot/descriptor in a window
        static bool isPickingUp            = false;     //shows an on-screen selection of nearby items able to be picked up
        static string pickupControl        = "P";       //the key to press and hold to show the pickup screen, pressing will pick closest item


        /// <summary>
        /// If pickupControl is pressed quick, attempt to grab the closest, first item nearest the player
        /// </summary>
        public static void QuickPickUp()
        {
            item grab = itemContainer.get_closest_item();
            if (grab == null)
            {
                Console.WriteLine("no items to quick-grab in range of (5) " + 5 * 16);
                return;
            }
            Console.WriteLine(grab.name);
            client.mob.add_to_inv(grab);
        }

        public static bool Add_To_Inventory(body who = null, item what=null)
        {
            bool worked = false;
            if (what.Equals(null))
                return worked;
            if (who.Equals(null))
                return worked;

            //who.updateInv;




            return worked;
        }

        public static void update(GameTime gameTime)
        {
            //display a hot-bar on the side of the screen.



        }

        public static void draw(SpriteBatch spriteBatch)
        {
           // spriteBatch.Draw(client.inv_back_texture, new Vector2(0, 0), new Rectangle(0, 0, client.inv_back_texture.Width, client.inv_back_texture.Height),
           //     Color.White, 0f, new Vector2(client.inv_back_texture.Width * 0.5f, client.inv_back_texture.Height * 0.5f), 1.0f, SpriteEffects.None, 0f);

            int add = 0;
            for (int a = 0; a < 10; a++)
            {

                spriteBatch.Draw(client.inv_back_texture,
                    new Vector2(client.cam.screenBounds.Width - client.inv_back_texture.Width, client.inv_back_texture.Height+add),

                    new Rectangle(0, 0, client.inv_back_texture.Width, client.inv_back_texture.Height),
                    Color.White,
                    0f,
                    new Vector2(client.inv_back_texture.Width * 0.5f, client.inv_back_texture.Height * 0.5f),
                    1.0f,
                    SpriteEffects.None,
                    0f

                    );
                add += client.inv_back_texture.Height+5;
            }
        }


    }
}
